<?php

Raise::load('core.RaiseVersion');

/**
 * TestCoreRaiseVersion class
 * Testing unit of 'phpraise/core/RaiseVersion.php'
 *
 * @author Sam-Mauris Yong <hellclanner at live dot com>
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Test
 */
class TestCoreRaiseVersion extends RaiseTest {

    public static function testVersioning(){
        self::assertClassExists('RaiseVersion');
        self::assertClassExtends('RaiseVersion', 'RaiseDataType');
        self::assertClassImplements('RaiseVersion', 'IRaiseComparable');
        $versionA = new RaiseVersion('5.0');
        $versionB = new RaiseVersion('5.1');
        $versionC = new RaiseVersion('5.0');
        $versionD = new RaiseVersion('8.6.3');
        self::assertTrue($versionA instanceof IRaiseComparable);

        self::assertTrue($versionA->compareTo($versionB, '<'));
        self::assertTrue($versionA->compareTo($versionC, '=='));
        self::assertTrue($versionA->compareTo($versionC, '<='));
        self::assertTrue($versionA->compareTo($versionC, '>='));
        self::assertTrue($versionD->compareTo($versionB, '>'));
        self::assertTrue($versionD->compareTo($versionC, '>'));
        self::assertTrue($versionD->compareTo($versionA, '>'));
    }

}
